package com.cn.jinl.controller;


import com.cn.jinl.api.ISystemLogService;
import com.cn.jinl.domain.SystemLog;
import com.cn.jinl.utils.JsonResponse;
import com.cn.jinl.utils.QueryForm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/systemLog")
public class SystemLogController {

    @Autowired
    private ISystemLogService systemLogService;

    @ResponseBody
    @RequestMapping("/querySystemLogs/{frontToken}")
    public JsonResponse<List<SystemLog>> querySystemLogs(QueryForm queryForm,@PathVariable(value = "frontToken",required = true) String frontToken) throws Exception {
        JsonResponse<List<SystemLog>> response = new JsonResponse<List<SystemLog>>();
        List<SystemLog> systemLogs = systemLogService.querySystemLogs(queryForm);
        response.setResult(systemLogs);
        response.setSuccess(true);
        return response;
    }

    @ResponseBody
    @RequestMapping("/queryAllSystemLogs/{frontToken}")
    public JsonResponse<List<SystemLog>> queryAllSystemLogs(QueryForm queryForm,@PathVariable(value = "frontToken",required = true) String frontToken) throws Exception {
        JsonResponse<List<SystemLog>> response = new JsonResponse<List<SystemLog>>();
        List<SystemLog> systemLogs = systemLogService.queryAllSystemLogs(queryForm);
        response.setResult(systemLogs);
        response.setSuccess(true);
        return response;
    }

}
